import java.util.Arrays;

/**
 * @USER: Administrator
 * @DATE: 2024/9/28 上午10:40
 * @VERSION: 1.0.0
 */
public class LC2605 {
    public static void main(String[] args) {
        LC2605 lc2605 = new LC2605();
        int[] num1 = new int[]{3,5,2,6};
        int[] num2 = new int[]{3,1,7};
        System.out.println(lc2605.minNumber(num1,num2));
    }

    public int minNumber(int[] nums1, int[] nums2) {
        Arrays.sort(nums1);
        Arrays.sort(nums2);
        int start = 0;
        for (int k : nums1) {
            for (int j = start; j < nums2.length; j++) {
                if (k == nums2[j]) {
                    return k;
                } else if (k < nums2[j]) {
                    start = j;
                    break;
                }
            }
        }
        return Math.min(nums1[0], nums2[0])*10+Math.max(nums1[0],nums2[0]);
    }

}
